{% extends 'index.html' %}
{% block title %}{% endblock %}
{% block head %}
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="static/css/bootstrap.min.css">
    <link rel="stylesheet" href="static/css/animate.min.css">
    <link rel="stylesheet/less" href="static/css/reset.less">
    <link rel="stylesheet" href="static/css/swiper-bundle.min.css">
    <link rel="stylesheet/less" href="static/css/index.less">
    <link rel="stylesheet/less" href="static/css/common.less">
{% endblock %}

{% block main %}
<div class="container content">
  <h1>商品管理后台 <small> 欢迎 {{session.username}}</small>
    <a class="btn btn-success" href="/add_product" style="float:right"> 发布商品 </a>
  </h1>
  <hr>
  <table class="table">
    <tr>
      <th>ID</th>
      <th>商品名称</th>
      <th>商品价格</th>
      <th></th>
      <th></th>
    </tr>
    {% for one_product in products %}
      <tr>
        <td> {{ one_product.id}}</td>
        <td> {{ one_product.pname}}</td>
        <td> {{ one_product.new_price}}</td>
        <td><a href="#" class="btn btn-info" style="float:right">编辑</a></td>
        <td>
          <form action="{{url_for('delete_product', id=one_product.id)}}" method="post">
            <input type="hidden" name="_method" value="DELETE">
            <input type="submit" value="删除" class="btn btn-danger">
          </form>
        </td>
      </tr>
      {% endfor %}
  </table>
</div>

{% endblock %}

<script src="/static/js/jquery-3.7.1.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/wow.min.repeat.js"></script>
<script src="/static/js/swiper-bundle.min.js"></script>
<script src="/static/js/less.js"></script>
<script>
    var mySwiper = new Swiper('.swiper', {
        loop: true, // 循环模式选项

        // 如果需要分页器
        pagination: {
            el: '.swiper-pagination',
        },

        // 如果需要前进后退按钮
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        }

    })

</script>

